@svizzle/utils/array-[number-number]

Methods

(static) makePolynomial(cofficients) → {function}

Source:
Since:
  • 0.3.0

Return a function that computes the polynomial of the input number using the provided cofficients.

Example
> // x => 2 x + 4 x^3
> poly = makePolynomial([0,2,0,4])
> poly(2)
36
> poly(5)
510
Parameters:
Name Type Description
cofficients array

Array of cofficients, the exponent corresponding to the their index

Returns:
  • Number -> Number
Type
function